<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Tymon\JWTAuth\Contracts\JWTSubject;

/**
 * App\Admin
 *
 * @mixin \Eloquent
 * @property int $id
 * @property string $nick_name 昵称
 * @property string $real_name 真实姓名
 * @property string $password 密码
 * @property int $sex 管理员性别1男2女3未知，默认为3
 * @property string $last 上次登录ip地址
 * @property string $last_time 上次登录时间
 * @property \Carbon\Carbon|null $created_at
 * @property \Carbon\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Admin whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Admin whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Admin whereLast($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Admin whereLastTime($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Admin whereNickName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Admin wherePassword($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Admin whereRealName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Admin whereSex($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Admin whereUpdatedAt($value)
 * @property string $avatar 管理员头像
 * @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Admin whereAvatar($value)
 * @property string $ip 最后登录ip地址
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Admin whereIp($value)
 */
class Admin extends Authenticatable implements JWTSubject
{
    use Notifiable;

    protected $dates = ['delete_at'];

    protected $guard_name = 'admin';

    protected $fillable = ['nick_name', 'password', 'avatar'];
    /**
     * Get the identifier that will be stored in the subject claim of the JWT.
     *
     * @return mixed
     */
    public function getJWTIdentifier()
    {
        return $this->getKey();
    }

    /**
     * Return a key value array, containing any custom claims to be added to the JWT.
     *
     * @return array
     */
    public function getJWTCustomClaims()
    {
        return [];
    }
}
